#include<string>
#include<iostream>
using namespace std;
int main(){
	string a;
	string b;
	string c;
	cin>>a>>b>>c;
	int pos;
	while(1){
		pos=a.find(b,0);
		if(pos<0){
			break;
		}
		a.replace(pos,b.size(),c);
	}
	cout<<a;
} 
